Convergence analysis of program variables

ABSTRACT

System and method for convergence analysis. One or more state variables of a first program may be determined based on dependencies of variables in a first program. A second program corresponding to the first program is created based on the state variables and their dependencies, and executed multiple times. Each execution may include recording values of the state variables, determining an execution count, comparing the values to corresponding values from previous executions of the second program, and terminating the executing in response to the values matching corresponding values from at least one previous execution of the second program. A convergence property for the first program is determined based on the execution count, and indicating a number of executions of the first program required to generate all possible values of the one or more variables. The convergence property is stored, and may be useable to optimize the first program.

FIELD OF THE INVENTION

The present invention relates to the field of program optimization, andmore particularly to a system and method for convergence analysis ofprogram variables.

DESCRIPTION OF THE RELATED ART

In the compilation of programs, certain optimizations that depend onknowing all possible values (which may be referred to herein as APV, forconvenience) of certain variables may be applied. For example, if oneknows all possible values of a variable are positive, then its data typemay be changed to be UNSIGNED. As another example, if one knows that allpossible values of a variable do not overlap those of a second variable,then any equality comparison between these two variables may be replacedby the constant FALSE.

Note that “all possible values” of a variable is different from its“range”. The range of a variable specifies its minimum and maximumvalues, and is a super set of all possible values of the variable, isnot the same. For example, all possible values of a first variable maybe even, all possible values of a second variable may be odd, and whilethese two variables may have overlapping ranges, their “all possiblevalues” are non-overlapping.

One way to determine all possible values of one or more variables in aprogram is to execute the program a number of times and collect actualvalues assigned to each of these variables during these executions. Asused herein, the term “convergence number” refers to the number of timesa program must be executed in order to collect all possible values for aparticular set of variables. If the convergence number N exists for aspecified set of variables in a program, the program may be executed Ntimes, and all actual values assigned to each of the variables collectedover the N executions to determine their APVs, thereby enablingoptimizations that depend on them.

However, determining whether such a convergence number (or moregenerally, a convergence property) exists for a given set of programvariables, and if so, its value, can be problematic and error prone.

Graphical programming has become a powerful tool available toprogrammers. Graphical programming environments such as the NationalInstruments LabVIEW product have become very popular. Tools such asLabVIEW have greatly increased the productivity of programmers, andincreasing numbers of programmers are using graphical programmingenvironments to develop their software applications. In particular,graphical programming tools are being used for test and measurement,data acquisition, process control, man machine interface (MMI),supervisory control and data acquisition (SCADA) applications, modeling,simulation, image processing/machine vision applications, and motioncontrol, among others.

SUMMARY OF THE INVENTION

Various embodiments of a system and method for convergence analysis ofprogram variables are presented below.

One or more state variables of a first program may be determined basedon dependencies of one or more variables in the first program. As usedherein, the term “state variable” refers to variables that carry (e.g.,preserve or maintain) state from one call of a program to another callof the program. Thus, for example, in the C programming language theseare global and static variables; in the LabVIEW™ graphical programmingsystem (i.e., the G programming language) state variables include“feedback” and “feed forward” nodes; and in hardware, state variablesare memories. Note that “feedback variables” (or nodes) are thosevariables that are dependent on themselves, i.e., that are dependentupon previous values of themselves, e.g., x=x+1, or more generally,{x,y}=(or :=, meaning “is assigned”) function(x, y), where x and y arevariables that (somehow) depend on one another. Thus, state variablesare different from normal variables in that their “lifetime” is longerthan a single execution of the program in which they are used.

The first program may be any of a variety of program types, e.g., one ormore of: a data flow program, a graphical program, a graphical data flowprogram, or a hardware description program, among others. As furtherexamples, in some embodiments, the first program may be or include oneor more of: a procedural program, a functional program, a textualprogram, or a declarative program. Additionally, it should be noted thatthe one or more variables upon whose dependencies the state variablesare (at least partially) determined may be of various kinds. Forexample, the one or more variables may include one or more of: at leastone variable in at least one array indexing expression for an array inthe first program, at least one set of variables that is dependent uponitself, or at least one variable whose value is set by an operation thatincludes input or output range properties to be optimized. In variousembodiments, the one or more variables may have data types including oneor more of: scalar, array, or heterogeneous data structure (i.e., withelements of different data types), which may also be referred to as acluster.

The dependencies (of the one or more variables) may include one or moreof: a data dependency through variable assignment, a control dependencythrough control structures, or a transitive closure of a data or controldependency, among others. The one or more state variables may includeone or more of: at least one static variable, at least one globalvariable, at least one feedback node in a dataflow language, at leastone modal parameter, or at least one parameter that takes on one of aplurality of values throughout execution of the first program.

Thus, a wide variety of first programs, variables, dependencies, andstate variables are contemplated.

A second program corresponding to the first program may be created basedon the one or more state variables and dependencies of the one or morestate variables. In various embodiments, the second program may have anyof a variety of forms (or combinations of such forms). For example, inone embodiment, the second program may be smaller than the firstprogram. In another embodiment, the second program may be a program thatexecutes faster than the first program. In a further embodiment, thesecond program may be an empty program with no state variables. In a yetfurther embodiment, the second program may be the same as the firstprogram. More generally, the second program may be or include one ormore of: smaller than the first program, a program that executes fasterthan the first program, an empty program with no state variables, or thesame as the first program.

The second program may be executed a plurality of times. For eachexecution, the method may perform: recording values of the one or morestate variables, determining an execution count, comparing the values tocorresponding values from previous executions of the second program, andterminating said executing in response to determining that the valuesmatch corresponding values from at least one previous execution of thesecond program. Note that in some embodiments, a stopping condition,e.g., an execution count threshold or other stopping condition may bespecified, and if matching values are not found before the stoppingcondition obtains, the iterative executions may terminate with a nullresult (and the method may indicate this null result to the user, e.g.,on the display, in a log file, etc.).

Recording values of the one or more state variables may include one ormore of: collecting unique values assigned to each variable, orcollecting one or more derivative properties for values assigned to eachvariable, e.g., storing maximum and/or minimum value so far, averagevalues, variance, etc.

In one embodiment, the above determining of one or more state variables,the creating, and the executing may be performed as part of compilingthe first program. Moreover, in various embodiments, where executing thesecond program may include one or more of: running compiled code on acomputer, where the compiled code is generated from at least a portionof the second program, interpreting program statements of at least aportion of the second program, or evaluating operations in a graphgenerated from at least a portion of the second program.

In one embodiment, the method may determine, based on the executioncount, a convergence property for the first program that indicates anumber of executions of the first program required to generate allpossible values of the one or more variables, and the convergenceproperty may be stored, e.g., in a memory medium. The convergenceproperty may then be useable to optimize the first program, as discussedin more detail below.

The convergence property may be of any of a variety of forms, including,but not limited to, one or more of: a finite integer value, a realvalue, indicating a fractional execution of the program, an indicationthat there is no convergence, or a convergence property for eachvariable of at least a subset of variables in the first program (e.g., aset of convergence properties).

In one embodiment, the method may further include compiling the firstprogram based on the convergence property, where the compiling includesgenerating code configured to run on one or more of: a desktop computerwith one or more central processing unit (CPU) cores, an embeddedcomputer with one or more CPU cores, a graphics processing unit (GPU),an embedded GPU, a field programmable gate array (FPGA), or anapplication specific integrated circuit (ASIC). Thus, any of a varietyof execution platforms may be used as desired.

In some embodiments, the method may further include optimizing the firstprogram based on the convergence property. Such optimizing may include,but is not limited to, one or more of: constant propagation and folding,range propagation and minimization, array size inference, dead codeelimination, loop transformations, array transformations, memoryoptimization, inserting assertions (e.g., assumptions, or properties fortesting purposes), inserting code coverage instrumentation, loopunrolling, in-lining of subprograms, out-lining of portions of programs,data type propagation and refinement, float to fixed data typeconversion, optimization of overflow/quantization operations, typeconversion insertion, or converting to look-up table implementations,among others.

BRIEF DESCRIPTION OF THE DRAWINGS

A better understanding of the present invention can be obtained when thefollowing detailed description of the preferred embodiment is consideredin conjunction with the following drawings, in which:

FIG. 1A illustrates a computer system configured to execute a graphicalprogram according to an embodiment of the present invention;

FIG. 1B illustrates a network system comprising two or more computersystems that may implement an embodiment of the present invention;

FIG. 2A illustrates an instrumentation control system according to oneembodiment of the invention;

FIG. 2B illustrates an industrial automation system according to oneembodiment of the invention;

FIG. 3A is a high level block diagram of an exemplary system which mayexecute or utilize graphical programs;

FIG. 3B illustrates an exemplary system which may perform control and/orsimulation functions utilizing graphical programs;

FIG. 4 is an exemplary block diagram of the computer systems of FIGS.1A, 1B, 2A and 2B and 3B;

FIG. 5 is a flowchart diagram illustrating one embodiment of a methodfor convergence analysis of program variables;

FIG. 6 is a flowchart diagram of an exemplary embodiment of the methodof FIG. 5; and

FIGS. 7A and 7B respectively illustrate an exemplary graphical firstprogram, and an exemplary graphical second program, according to oneembodiment.

While the invention is susceptible to various modifications andalternative forms, specific embodiments thereof are shown by way ofexample in the drawings and are herein described in detail. It should beunderstood, however, that the drawings and detailed description theretoare not intended to limit the invention to the particular formdisclosed, but on the contrary, the intention is to cover allmodifications, equivalents and alternatives falling within the spiritand scope of the present invention as defined by the appended claims.

DETAILED DESCRIPTION OF THE INVENTION Incorporation by Reference

The following references are hereby incorporated by reference in theirentirety as though fully and completely set forth herein:

-   U.S. Pat. No. 4,914,568 titled “Graphical System for Modeling a    Process and Associated Method,” issued on Apr. 3, 1990.-   U.S. Pat. No. 5,481,741 titled “Method and Apparatus for Providing    Attribute Nodes in a Graphical Data Flow Environment”.-   U.S. Pat. No. 6,173,438 titled “Embedded Graphical Programming    System” filed Aug. 18, 1997.-   U.S. Pat. No. 6,219,628 titled “System and Method for Configuring an    Instrument to Perform Measurement Functions Utilizing Conversion of    Graphical Programs into Hardware Implementations,” filed Aug. 18,    1997.-   U.S. Pat. No. 7,210,117 titled “System and Method for    Programmatically Generating a Graphical Program in Response to    Program Information,” filed Dec. 20, 2000.

TERMS

The following is a glossary of terms used in the present application:

Memory Medium—Any of various types of non-transitory computer accessiblememory devices or storage devices. The term “memory medium” is intendedto include an installation medium, e.g., a CD-ROM, floppy disks 104, ortape device; a computer system memory or random access memory such asDRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; a non-volatile memorysuch as a Flash, magnetic media, e.g., a hard drive, or optical storage;registers, or other similar types of memory elements, etc. The memorymedium may comprise other types of non-transitory memory as well orcombinations thereof. In addition, the memory medium may be located in afirst computer in which the programs are executed, or may be located ina second different computer which connects to the first computer over anetwork, such as the Internet. In the latter instance, the secondcomputer may provide program instructions to the first computer forexecution. The term “memory medium” may include two or more memorymediums which may reside in different locations, e.g., in differentcomputers that are connected over a network.

Carrier Medium—a memory medium as described above, as well as a physicaltransmission medium, such as a bus, network, and/or other physicaltransmission medium that conveys signals such as electrical,electromagnetic, or digital signals.

Programmable Hardware Element—includes various hardware devicescomprising multiple programmable function blocks connected via aprogrammable interconnect. Examples include FPGAs (Field ProgrammableGate Arrays), PLDs (Programmable Logic Devices), FPOAs (FieldProgrammable Object Arrays), and CPLDs (Complex PLDs). The programmablefunction blocks may range from fine grained (combinatorial logic or lookup tables) to coarse grained (arithmetic logic units or processorcores). A programmable hardware element may also be referred to as“reconfigurable logic”.

Software Program—the term “software program” is intended to have thefull breadth of its ordinary meaning, and includes any type of programinstructions, code, script and/or data, or combinations thereof, thatmay be stored in a memory medium and executed by a processor. Exemplarysoftware programs include programs written in text-based programminglanguages, such as C, C++, PASCAL, FORTRAN, COBOL, JAVA, assemblylanguage, etc.; graphical programs (programs written in graphicalprogramming languages); assembly language programs; programs that havebeen compiled to machine language; scripts; and other types ofexecutable software. A software program may comprise two or moresoftware programs that interoperate in some manner. Note that variousembodiments described herein may be implemented by a computer orsoftware program. A software program may be stored as programinstructions on a memory medium.

Hardware Configuration Program—a program, e.g., a netlist or bit file,that can be used to program or configure a programmable hardwareelement.

Program—the term “program” is intended to have the full breadth of itsordinary meaning. The term “program” includes 1) a software programwhich may be stored in a memory and is executable by a processor or 2) ahardware configuration program useable for configuring a programmablehardware element.

Graphical Program—A program comprising a plurality of interconnectednodes or icons, wherein the plurality of interconnected nodes or iconsvisually indicate functionality of the program. The interconnected nodesor icons are graphical source code for the program. Graphical functionnodes may also be referred to as blocks.

The following provides examples of various aspects of graphicalprograms. The following examples and discussion are not intended tolimit the above definition of graphical program, but rather provideexamples of what the term “graphical program” encompasses:

The nodes in a graphical program may be connected in one or more of adata flow, control flow, and/or execution flow format. The nodes mayalso be connected in a “signal flow” format, which is a subset of dataflow.

Exemplary graphical program development environments which may be usedto create graphical programs include LabVIEW®, DasyLab™, DIADem™ andMatrixx/SystemBuild™ from National Instruments, Simulink® from theMathWorks, VEE™ from Agilent, WiT™ from Coreco, Vision Program Manager™from PPT Vision, SoftWIRE™ from Measurement Computing, Sanscript™ fromNorthwoods Software, Khoros™ from Khoral Research, SnapMaster™ from HEMData, VisSim™ from Visual Solutions, ObjectBench™ by SES (Scientific andEngineering Software), and VisiDAQ™ from Advantech, among others.

The term “graphical program” includes models or block diagrams createdin graphical modeling environments, wherein the model or block diagramcomprises interconnected blocks (i.e., nodes) or icons that visuallyindicate operation of the model or block diagram; exemplary graphicalmodeling environments include Simulink®, SystemBuild™, VisSim™,Hypersignal Block Diagram™, etc.

A graphical program may be represented in the memory of the computersystem as data structures and/or program instructions. The graphicalprogram, e.g., these data structures and/or program instructions, may becompiled or interpreted to produce machine language that accomplishesthe desired method or process as shown in the graphical program.

Input data to a graphical program may be received from any of varioussources, such as from a device, unit under test, a process beingmeasured or controlled, another computer program, a database, or from afile. Also, a user may input data to a graphical program or virtualinstrument using a graphical user interface, e.g., a front panel.

A graphical program may optionally have a GUI associated with thegraphical program. In this case, the plurality of interconnected blocksor nodes are often referred to as the block diagram portion of thegraphical program.

Node—In the context of a graphical program, an element that may beincluded in a graphical program. The graphical program nodes (or simplynodes) in a graphical program may also be referred to as blocks. A nodemay have an associated icon that represents the node in the graphicalprogram, as well as underlying code and/or data that implementsfunctionality of the node. Exemplary nodes (or blocks) include functionnodes, sub-program nodes, terminal nodes, structure nodes, etc. Nodesmay be connected together in a graphical program by connection icons orwires.

Data Flow Program—A Software Program in which the program architectureis that of a directed graph specifying the flow of data through theprogram, and thus functions execute whenever the necessary input dataare available. Said another way, data flow programs execute according toa data flow model of computation under which program functions arescheduled for execution in response to their necessary input databecoming available. Data flow programs can be contrasted with proceduralprograms, which specify an execution flow of computations to beperformed. As used herein “data flow” or “data flow programs” refer to“dynamically-scheduled data flow” and/or “statically-defined data flow”.

Graphical Data Flow Program (or Graphical Data Flow Diagram)—A GraphicalProgram which is also a Data Flow Program. A Graphical Data Flow Programcomprises a plurality of interconnected nodes (blocks), wherein at leasta subset of the connections among the nodes visually indicate that dataproduced by one node is used by another node. A LabVIEW VI is oneexample of a graphical data flow program. A Simulink block diagram isanother example of a graphical data flow program.

Graphical User Interface—this term is intended to have the full breadthof its ordinary meaning. The term “Graphical User Interface” is oftenabbreviated to “GUI”. A GUI may comprise only one or more input GUIelements, only one or more output GUI elements, or both input and outputGUI elements.

The following provides examples of various aspects of GUIs. Thefollowing examples and discussion are not intended to limit the ordinarymeaning of GUI, but rather provide examples of what the term “graphicaluser interface” encompasses:

A GUI may comprise a single window having one or more GUI Elements, ormay comprise a plurality of individual GUI Elements (or individualwindows each having one or more GUI Elements), wherein the individualGUI Elements or windows may optionally be tiled together.

A GUI may be associated with a graphical program. In this instance,various mechanisms may be used to connect GUI Elements in the GUI withnodes in the graphical program. For example, when Input Controls andOutput Indicators are created in the GUI, corresponding nodes (e.g.,terminals) may be automatically created in the graphical program orblock diagram. Alternatively, the user can place terminal nodes in theblock diagram which may cause the display of corresponding GUI Elementsfront panel objects in the GUI, either at edit time or later at runtime. As another example, the GUI may comprise GUI Elements embedded inthe block diagram portion of the graphical program.

Front Panel—A Graphical User Interface that includes input controls andoutput indicators, and which enables a user to interactively control ormanipulate the input being provided to a program, and view output of theprogram, while the program is executing.

A front panel is a type of GUI. A front panel may be associated with agraphical program as described above.

In an instrumentation application, the front panel can be analogized tothe front panel of an instrument. In an industrial automationapplication the front panel can be analogized to the MMI (Man MachineInterface) of a device. The user may adjust the controls on the frontpanel to affect the input and view the output on the respectiveindicators.

Graphical User Interface Element—an element of a graphical userinterface, such as for providing input or displaying output. Exemplarygraphical user interface elements comprise input controls and outputindicators.

Input Control—a graphical user interface element for providing userinput to a program. An input control displays the value input by theuser and is capable of being manipulated at the discretion of the user.Exemplary input controls comprise dials, knobs, sliders, input textboxes, etc.

Output Indicator—a graphical user interface element for displayingoutput from a program. Exemplary output indicators include charts,graphs, gauges, output text boxes, numeric displays, etc. An outputindicator is sometimes referred to as an “output control”.

Computer System—any of various types of computing or processing systems,including a personal computer system (PC), mainframe computer system,workstation, network appliance, Internet appliance, personal digitalassistant (PDA), television system, grid computing system, or otherdevice or combinations of devices. In general, the term “computersystem” can be broadly defined to encompass any device (or combinationof devices) having at least one processor that executes instructionsfrom a memory medium.

Measurement Device—includes instruments, data acquisition devices, smartsensors, and any of various types of devices that are configured toacquire and/or store data. A measurement device may also optionally befurther configured to analyze or process the acquired or stored data.Examples of a measurement device include an instrument, such as atraditional stand-alone “box” instrument, a computer-based instrument(instrument on a card) or external instrument, a data acquisition card,a device external to a computer that operates similarly to a dataacquisition card, a smart sensor, one or more DAQ or measurement cardsor modules in a chassis, an image acquisition device, such as an imageacquisition (or machine vision) card (also called a video capture board)or smart camera, a motion control device, a robot having machine vision,and other similar types of devices. Exemplary “stand-alone” instrumentsinclude oscilloscopes, multimeters, signal analyzers, arbitrary waveformgenerators, spectroscopes, and similar measurement, test, or automationinstruments.

A measurement device may be further configured to perform controlfunctions, e.g., in response to analysis of the acquired or stored data.For example, the measurement device may send a control signal to anexternal system, such as a motion control system or to a sensor, inresponse to particular data. A measurement device may also be configuredto perform automation functions, i.e., may receive and analyze data, andissue automation control signals in response.

Functional Unit (or Processing Element)—refers to various elements orcombinations of elements. Processing elements include, for example,circuits such as an ASIC (Application Specific Integrated Circuit),portions or circuits of individual processor cores, entire processorcores, individual processors, programmable hardware devices such as afield programmable gate array (FPGA), and/or larger portions of systemsthat include multiple processors, as well as any combinations thereof.

Automatically—refers to an action or operation performed by a computersystem (e.g., software executed by the computer system) or device (e.g.,circuitry, programmable hardware elements, ASICs, etc.), without userinput directly specifying or performing the action or operation. Thusthe term “automatically” is in contrast to an operation being manuallyperformed or specified by the user, where the user provides input todirectly perform the operation. An automatic procedure may be initiatedby input provided by the user, but the subsequent actions that areperformed “automatically” are not specified by the user, i.e., are notperformed “manually”, where the user specifies each action to perform.For example, a user filling out an electronic form by selecting eachfield and providing input specifying information (e.g., by typinginformation, selecting check boxes, radio selections, etc.) is fillingout the form manually, even though the computer system must update theform in response to the user actions. The form may be automaticallyfilled out by the computer system where the computer system (e.g.,software executing on the computer system) analyzes the fields of theform and fills in the form without any user input specifying the answersto the fields. As indicated above, the user may invoke the automaticfilling of the form, but is not involved in the actual filling of theform (e.g., the user is not manually specifying answers to fields butrather they are being automatically completed). The presentspecification provides various examples of operations beingautomatically performed in response to actions the user has taken.

Concurrent—refers to parallel execution or performance, where tasks,processes, or programs are performed in an at least partiallyoverlapping manner. For example, concurrency may be implemented using“strong” or strict parallelism, where tasks are performed (at leastpartially) in parallel on respective computational elements, or using“weak parallelism”, where the tasks are performed in an interleavedmanner, e.g., by time multiplexing of execution threads.

Convergence Property—an indication of the number of times a program mustbe executed in order to collect all possible values for a particular setof variables. One particular example of a convergence property is aconvergence number, which is thus the number of times the program mustbe executed in order to collect all possible values for a particular setof variables, e.g., array indices. Other forms of a convergence propertymay include multiple such numbers, e.g., for array indices of differentarrays, or derivative values, e.g., maximum convergence numbers, etc.,and so forth, as desired.

Compatible—refers to transforms that can operate on the same datawithout conflict. For example, consider array partitioning transformsafter unrolling program loops, where the array partitions in theseunrolled loops for the same arrays do not conflict with one another. Forexample, if one loop unroll would partition an array into two sub-arraysof equal sizes, and another loop unroll of a different loop wouldpartition the same array into three sub-arrays of equal sizes, thepartitions (two and three) are considered incompatible because a singlearray cannot simultaneously be partitioned into two and three arrays atthe same time. In contrast, if the partition numbers are instead two andfour, they are compatible because an array can be partitioned into twoarrays of equal sizes, which can then each be partitioned into anothertwo further sub-arrays of equal sizes, therefore making four sub-arraysof equal sizes. Thus, two effects (e.g., partition numbers) on the samedata (in this case, partitioning the same array into two and into foursub-arrays) are compatible if one transform is a subset of another(partitioning into 4 arrays subsumes partitioning into two sub-arrays).Thus, this particular array partitioning is an example where “equality”of transforms (and their effects) is not required, but rather where onetransform (and its effects) is “subsumed” by another transform (four isdivisible by two).

Jamming Factor (of arrays)—in the context of program looptransformations, e.g., “unroll-and-jam” loop transformation that includeloop unrolling followed by loop fusion, refers to the loop unrollingfactor.

Array Remapping—refers to rewriting a program's array accesses asaccesses to a second array of different dimension and/or data types.Note that there are more general versions of array remapping, but thatimportant array remappings include cases where an N word by M bit arrayis rewritten into an N/2 by M*2 bit array, or N/4 by M*4 bit array.Thus, for example, a 100 word array of integers may be remapped into a50 word array of longs (long integers), changing all array accessesaccordingly).

FIG. 1A—Computer System

FIG. 1A illustrates a computer system 82 configured to implementembodiments of the present techniques.

As shown in FIG. 1A, the computer system 82 may include a display deviceconfigured to display a program, such as a graphical program, as theprogram is created, executed, or analyzed.

The display device may also be configured to display a graphical userinterface, e.g., in embodiments where the program is a graphicalprogram, a front panel, of the program during execution of the program.The graphical user interface may comprise any type of graphical userinterface, e.g., depending on the computing platform.

The computer system 82 may include at least one memory medium on whichone or more computer programs or software components according toembodiments of the present invention may be stored. For example, in someembodiments, the computer system may store one or more software toolsconfigured to perform the convergence analysis techniques disclosedherein. For example, in some embodiments, the memory medium may storeone or more graphical programs which are executable to perform themethods described herein. Additionally, the memory medium may store agraphical programming development environment application used to createand/or execute such graphical programs. In some embodiments, thesoftware tool(s) may be incorporated in or integrated into thedevelopment environment. The memory medium may also store operatingsystem software, as well as other software for operation of the computersystem. Various embodiments further include receiving or storinginstructions and/or data implemented in accordance with the foregoingdescription upon a carrier medium.

FIG. 1B—Computer Network

FIG. 1B illustrates a system including a first computer system 82 thatis coupled to a second computer system 90. The computer system 82 may becoupled via a network 84 (or a computer bus) to the second computersystem 90. The computer systems 82 and 90 may each be any of varioustypes, as desired. The network 84 can also be any of various types,including a LAN (local area network), WAN (wide area network), theInternet, or an Intranet, among others. The computer systems 82 and 90may be configured to execute a graphical program in a distributedfashion. For example, computer 82 may execute a first portion of theblock diagram of a graphical program and computer system 90 may executea second portion of the block diagram of the graphical program. Asanother example, computer 82 may display the graphical user interface ofa graphical program and computer system 90 may execute the block diagramof the graphical program.

In one embodiment, the graphical user interface of the graphical programmay be displayed on a display device of the computer system 82, and theblock diagram may execute on a device coupled to the computer system 82.The device may include a programmable hardware element and/or mayinclude a processor and memory medium which may execute a real timeoperating system. In one embodiment, the graphical program may bedownloaded and executed on the device. For example, an applicationdevelopment environment with which the graphical program is associatedmay provide support for downloading a graphical program for execution onthe device in a real time system. Note, however, that in variousembodiments, any type of program may be used or analyzed as desired,e.g., textual or graphical programs.

Exemplary Systems

Embodiments of the present invention may be involved with performingtest and/or measurement functions; controlling and/or modelinginstrumentation or industrial automation hardware; modeling andsimulation functions, e.g., modeling or simulating a device or productbeing developed or tested, etc. Exemplary test applications where thegraphical program may be used include hardware-in-the-loop testing andrapid control prototyping, among others.

However, it is noted that embodiments of the present invention can beused for a plethora of applications and is not limited to the aboveapplications. In other words, applications discussed in the presentdescription are exemplary only, and embodiments of the present inventionmay be used in any of various types of systems. Thus, embodiments of thesystem and method of the present invention is configured to be used inany of various types of applications, including the control of othertypes of devices such as multimedia devices, video devices, audiodevices, telephony devices, Internet devices, etc., as well as generalpurpose software applications such as word processing, spreadsheets,network control, network monitoring, financial applications, games, etc.

FIG. 2A illustrates an exemplary instrumentation control system 100which may implement embodiments of the invention. The system 100comprises a host computer 82 which couples to one or more instruments.The host computer 82 may comprise a CPU, a display screen, memory, andone or more input devices such as a mouse or keyboard as shown. Thecomputer 82 may operate with the one or more instruments to analyze,measure or control a unit under test (UUT) or process 150, e.g., viaexecution of software 104.

The one or more instruments may include a GPIB instrument 112 andassociated GPIB interface card 122, a data acquisition board 114inserted into or otherwise coupled with chassis 124 with associatedsignal conditioning circuitry 126, a VXI instrument 116, a PXIinstrument 118, a video device or camera 132 and associated imageacquisition (or machine vision) card 134, a motion control device 136and associated motion control interface card 138, and/or one or morecomputer based instrument cards 142, among other types of devices. Thecomputer system may couple to and operate with one or more of theseinstruments. The instruments may be coupled to the unit under test (UUT)or process 150, or may be coupled to receive field signals, typicallygenerated by transducers. The system 100 may be used in a dataacquisition and control application, in a test and measurementapplication, an image processing or machine vision application, aprocess control application, a man-machine interface application, asimulation application, or a hardware-in-the-loop validationapplication, among others.

FIG. 2B illustrates an exemplary industrial automation system 200 whichmay implement embodiments of the invention. The industrial automationsystem 200 is similar to the instrumentation or test and measurementsystem 100 shown in FIG. 2A. Elements which are similar or identical toelements in FIG. 2A have the same reference numerals for convenience.The system 200 may comprise a computer 82 which couples to one or moredevices or instruments. The computer 82 may comprise a CPU, a displayscreen, memory, and one or more input devices such as a mouse orkeyboard as shown. The computer 82 may operate with the one or moredevices to perform an automation function with respect to a process ordevice 150, such as MMI (Man Machine Interface), SCADA (SupervisoryControl and Data Acquisition), portable or distributed data acquisition,process control, advanced analysis, or other control, among others,e.g., via execution of software 104.

The one or more devices may include a data acquisition board 114inserted into or otherwise coupled with chassis 124 with associatedsignal conditioning circuitry 126, a PXI instrument 118, a video device132 and associated image acquisition card 134, a motion control device136 and associated motion control interface card 138, a fieldbus device270 and associated fieldbus interface card 172, a PLC (ProgrammableLogic Controller) 176, a serial instrument 282 and associated serialinterface card 184, or a distributed data acquisition system, such asFieldpoint system 185, available from National Instruments Corporation,among other types of devices.

FIG. 3A is a high level block diagram of an exemplary system which mayexecute or utilize graphical programs. FIG. 3A illustrates a generalhigh-level block diagram of a generic control and/or simulation systemwhich comprises a controller 92 and a plant 94. The controller 92represents a control system/algorithm the user may be trying to develop.The plant 94 represents the system the user may be trying to control.For example, if the user is designing an ECU for a car, the controller92 is the ECU and the plant 94 is the car's engine (and possibly othercomponents such as transmission, brakes, and so on.) As shown, a usermay create a graphical program that specifies or implements thefunctionality of one or both of the controller 92 and the plant 94. Forexample, a control engineer may use a modeling and simulation tool tocreate a model (graphical program) of the plant 94 and/or to create thealgorithm (graphical program) for the controller 92.

FIG. 3B illustrates an exemplary system which may perform control and/orsimulation functions. As shown, the controller 92 may be implemented bya computer system 82 or other device (e.g., including a processor andmemory medium and/or including a programmable hardware element) thatexecutes or implements a graphical program. In a similar manner, theplant 94 may be implemented by a computer system or other device 144(e.g., including a processor and memory medium and/or including aprogrammable hardware element) that executes or implements a graphicalprogram, or may be implemented in or as a real physical system, e.g., acar engine.

In one embodiment of the invention, one or more graphical programs maybe created which are used in performing rapid control prototyping. RapidControl Prototyping (RCP) generally refers to the process by which auser develops a control algorithm and quickly executes that algorithm ona target controller connected to a real system. The user may develop thecontrol algorithm using a graphical program, and the graphical programmay execute on the controller 92, e.g., on a computer system or otherdevice. The computer system 82 may be a platform that supports real timeexecution, e.g., a device including a processor that executes a realtime operating system (RTOS), or a device including a programmablehardware element.

In one embodiment of the invention, one or more graphical programs maybe created which are used in performing Hardware in the Loop (HIL)simulation. Hardware in the Loop (HIL) refers to the execution of theplant model 94 in real time to test operation of a real controller 92.For example, once the controller 92 has been designed, it may beexpensive and complicated to actually test the controller 92 thoroughlyin a real plant, e.g., a real car. Thus, the plant model (implemented bya graphical program) is executed in real time to make the realcontroller 92 “believe” or operate as if it is connected to a realplant, e.g., a real engine.

In the embodiments of FIGS. 2A, 2B, and 3B above, one or more of thevarious devices may couple to each other over a network, such as theInternet. In one embodiment, the user operates to select a target devicefrom a plurality of possible target devices for programming orconfiguration using a graphical program. Thus the user may create agraphical program on a computer and use (execute) the graphical programon that computer or deploy the graphical program to a target device (forremote execution on the target device) that is remotely located from thecomputer and coupled to the computer through a network.

Graphical software programs which perform data acquisition, analysisand/or presentation, e.g., for measurement, instrumentation control,industrial automation, modeling, or simulation, such as in theapplications shown in FIGS. 2A and 2B, may be referred to as virtualinstruments.

FIG. 4—Computer System Block Diagram

FIG. 4 is a block diagram 12 representing one embodiment of the computersystem 82 and/or 90 illustrated in FIGS. 1A and 1B, or computer system82 shown in FIG. 2A or 2B. It is noted that any type of computer systemconfiguration or architecture can be used as desired, and FIG. 4illustrates a representative PC embodiment. It is also noted that thecomputer system may be a general purpose computer system, a computerimplemented on a card installed in a chassis, or other types ofembodiments. Elements of a computer not necessary to understand thepresent description have been omitted for simplicity.

The computer may include at least one central processing unit or CPU(processor) 160 which is coupled to a processor or host bus 162. The CPU160 may be any of various types, including an x86 processor, e.g., aPentium class, a PowerPC processor, a CPU from the SPARC family of RISCprocessors, as well as others. A memory medium, typically comprising RAMand referred to as main memory, 166 is coupled to the host bus 162 bymeans of memory controller 164. The main memory 166 may store one ormore programs configured to perform convergence analysis on programvariables, according to the present techniques. The main memory may alsostore operating system software, as well as other software for operationof the computer system.

The host bus 162 may be coupled to an expansion or input/output bus 170by means of a bus controller 168 or bus bridge logic. The expansion bus170 may be the PCI (Peripheral Component Interconnect) expansion bus,although other bus types can be used. The expansion bus 170 includesslots for various devices such as described above. The computer 82further comprises a video display subsystem 180 and hard drive 182coupled to the expansion bus 170. The computer 82 may also comprise aGPIB card 122 coupled to a GPIB bus 112, and/or an MXI device 186coupled to a VXI chassis 116.

As shown, a device 190 may also be connected to the computer. The device190 may include a processor and memory which may execute a real timeoperating system. The device 190 may also or instead comprise aprogrammable hardware element. The computer system may be configured todeploy a graphical program to the device 190 for execution of thegraphical program on the device 190. The deployed graphical program maytake the form of graphical program instructions or data structures thatdirectly represents the graphical program. Alternatively, the deployedgraphical program may take the form of text code (e.g., C code)generated from the graphical program. As another example, the deployedgraphical program may take the form of compiled code generated fromeither the graphical program or from text code that in turn wasgenerated from the graphical program.

FIG. 5—Flowchart of a Method for Convergence Analysis of ProgramVariables

FIG. 5 illustrates a method for performing convergence analysis ofprogram variables. The method shown in FIG. 5 may be used in conjunctionwith any of the computer systems or devices shown in the above Figures,among other devices. In various embodiments, some of the method elementsshown may be performed concurrently, in a different order than shown, ormay be omitted. Additional method elements may also be performed asdesired. As shown, this method may operate as follows.

In 502, one or more state variables of a first program may be determinedbased on dependencies of one or more variables in the first program. Asused herein, the term “state variable” refers to variables that carry(e.g., preserve or maintain) state from one call of a program to anothercall of the program. Thus, for example, in the C programming languagethese are global and static variables; in the LabVIEW™ graphicalprogramming system (i.e., the G programming language) state variablesinclude “feedback” and “feed forward” nodes; and in hardware, statevariables are memories. Note that “feedback variables” (or nodes) arethose variables that are dependent on themselves, i.e., that aredependent upon previous values of themselves, e.g., x=x+1, or moregenerally, {x,y}=(or :=, meaning “is assigned”) function(x, y), where xand y are variables that (somehow) depend on one another.

Thus, state variables are different from normal variables in that their“lifetime” is longer than a single execution of the program in whichthey are used.

The first program may be any of a variety of program types, e.g., one ormore of: a data flow program, a graphical program, a graphical data flowprogram, or a hardware description program, among others. As furtherexamples, in some embodiments, the first program may be or include oneor more of: a procedural program, a functional program, a textualprogram, or a declarative program.

Additionally, it should be noted that the one or more variables uponwhose dependencies the state variables are (at least partially)determined may be of various kinds. For example, the one or morevariables may include one or more of: at least one variable in at leastone array indexing expression for an array in the first program, atleast one set of variables that is dependent upon itself, or at leastone variable whose value is set by an operation that includes input oroutput range properties to be optimized. In various embodiments, the oneor more variables may have data types including one or more of: scalar,array, or heterogeneous data structure (i.e., with elements of differentdata types), which may also be referred to as a cluster.

The dependencies (of the one or more variables) may include one or moreof: a data dependency through variable assignment, a control dependencythrough control structures, or a transitive closure of a data or controldependency, among others. The one or more state variables may includeone or more of: at least one static variable, at least one globalvariable, at least one feedback node in a dataflow language, at leastone modal parameter, or at least one parameter that takes on one of aplurality of values throughout execution of the first program.

Thus, a wide variety of first programs, variables, dependencies, andstate variables are contemplated.

In 504, a second program corresponding to the first program may becreated based on the one or more state variables and dependencies of theone or more state variables. In various embodiments, the second programmay have any of a variety of forms (or combinations of such forms). Forexample, in one embodiment, the second program may be smaller than thefirst program. In another embodiment, the second program may be aprogram that executes faster than the first program. In a furtherembodiment, the second program may be an empty program with no statevariables. In a yet further embodiment, the second program may be thesame as the first program. More generally, the second program may be orinclude one or more of: smaller than the first program, a program thatexecutes faster than the first program, an empty program with no statevariables, or the same as the first program.

In 506, the second program may be executed a plurality of times. As FIG.5 indicates, for each execution, the method may perform: recordingvalues of the one or more state variables, as shown in 512, determiningan execution count, as per 514, comparing the values to correspondingvalues from previous executions of the second program, as indicated in516, and terminating said executing in response to determining that thevalues match corresponding values from at least one previous executionof the second program, per 518. Note that in some embodiments, astopping condition, e.g., an execution count threshold or other stoppingcondition may be specified, and if matching values are not found beforethe stopping condition obtains, the iterative executions may terminatewith a null result (and the method may indicate this null result to theuser, e.g., on the display, in a log file, etc.).

Recording values of the one or more state variables may include one ormore of: collecting unique values assigned to each variable, orcollecting one or more derivative properties for values assigned to eachvariable, e.g., storing maximum and/or minimum value so far, averagevalues, variance, etc.

In one embodiment, the determining one or more state variables (502),the creating (504), and the executing (506) may be performed as part ofcompiling the first program. Moreover, in various embodiments, whereexecuting the second program (506) may include one or more of: runningcompiled code on a computer, where the compiled code is generated fromat least a portion of the second program, interpreting programstatements of at least a portion of the second program, or evaluatingoperations in a graph generated from at least a portion of the secondprogram.

As FIG. 5 also shows, in 508, the method may determine, based on theexecution count, a convergence property for the first program thatindicates a number of executions of the first program required togenerate all possible values of the one or more variables, and in 510,the convergence property may be stored. The convergence property maythen be useable to optimize the first program, as discussed in moredetail below.

The convergence property may be of any of a variety of forms, including,but not limited to, one or more of: a finite integer value, a realvalue, indicating a fractional execution of the program, an indicationthat there is no convergence, or a convergence property for eachvariable of at least a subset of variables in the first program (e.g., aset of convergence properties).

In one embodiment, the method may further include compiling the firstprogram based on the convergence property, where the compiling includesgenerating code configured to run on one or more of: a desktop computerwith one or more central processing unit (CPU) cores, an embeddedcomputer with one or more CPU cores, a graphics processing unit (GPU),an embedded GPU, a field programmable gate array (FPGA), or anapplication specific integrated circuit (ASIC). Thus, any of a varietyof execution platforms may be used as desired.

In some embodiments, the method may further include optimizing the firstprogram based on the convergence property. Such optimizing may include,but is not limited to, one or more of: constant propagation and folding,range propagation and minimization, array size inference, dead codeelimination, loop transformations, array transformations, memoryoptimization, inserting assertions (e.g., assumptions, or properties fortesting purposes), inserting code coverage instrumentation, loopunrolling, in-lining of subprograms, out-lining of portions of programs,data type propagation and refinement, float to fixed data typeconversion, optimization of overflow/quantization operations, typeconversion insertion, or converting to look-up table implementations,among others.

Further details and exemplary embodiments are presented below.

Exemplary First Program (Textual)

Consider an exemplary first program that has multiple variables, forexample, a, b, c, d, some “state variables”, for example, x, y, z, aswell as some inputs, e.g., i1, i2, and output, e.g., o1:

static int x:=0; // state variable x, y, z initialized to 0

static int y:=0;

static int z:=0;

first program (input:i1, input:i2, output:o1)

{

-   -   int a, b, c, d;    -   a:=x+1;    -   b:=i1+z;    -   c:=i2+z;    -   d:=y;    -   o1:=a+b+c+d;    -   x:=x+y;    -   y:=y+1;    -   z:=z−1;

}

Now, consider, for example, analyzing the history of variable “a” forall executions of the program. First, note that the dependency ofvariable “a” includes the state variable “x” (because a:=x+1). Asexplained above, the dependency of a variable is the set of variablesused to calculate the variable.

Note that the state variable x is in turn dependent on state variables xand y (because x:=x+y), and so, to analyze history of “a”, the methodascertains its dependent state variables, in this case “x”, and allstate variables it/they depend on, in this case, “x and y”. Theconvergence property can be determined from this final set of statevariables “x and y”, and so in this example, state variable z, and othervariables a, b, c, d, can be excluded from the convergence analysis.

In the above example, the “portion of program extracted from statevariables and their dependencies” would be (assuming the state variablesare x and y):

x:=x+y;

y:=y+1;

This is an exemplary example of the “smaller program” case mentionedabove based on this analysis of variable “a”. Note that this example(much smaller program) illustrates a particularly beneficial aspect ofone embodiment of the present techniques; that to analyze theconvergence for variable “a”, it may be sufficient to extract andanalyze only this (usually much smaller) second program.

Note that the above-mentioned special case where the second program(extracted from the first program) is an “empty program” occurs whenthere are no state variables, in which case, the set of state variablesthat a variable depends on is empty, and so the “second program” that isextracted from the first program is empty—no state variable, noassignments to state variables, etc., and thus the second program isreally no program at all. This case may be detected by the method (nostate variables found), and accordingly, the convergence number (orproperty) may be 1. In other words, any program without dependency onstate variables may have a convergence number or property of 1.

Alternatively, in the case where all variables in a program are statevariables, the second program may be identical to the original program.

FIG. 6—Flowchart of Another Method for Convergence Analysis of GraphicalProgram Variables

FIG. 6 illustrates a method for performing convergence analysis ofprogram variables in a graphical program, according to one embodiment,and may be considered an exemplary embodiment or variation of the methodof FIG. 5. The method shown in FIG. 6 may be used in conjunction withany of the computer systems or devices shown in the above Figures, amongother devices. In various embodiments, some of the method elements shownmay be performed concurrently, in a different order than shown, or maybe omitted. Additional method elements may also be performed as desired.As shown, this method may operate as follows.

In 602, all state variables that drive array access indices in agraphical first program may be determined (or found/identified), e.g.,for each array in the program. FIG. 7A illustrates an exemplarygraphical first program, according to one embodiment. Note thatgraphical program elements that are not particularly relevant to thepresent techniques are not described. Note further that in suchgraphical programs, variables, which are the means by which data aretransferred, may be represented (or implemented) by “wires” that connect(graphical program) nodes and terminals.

In 604, all graphical program nodes that drive the state variables (of602) may be tagged (via any tagging techniques desired, including directand indirect tagging approaches). In other words, the nodes (graphicalprogram logic) that form the fanin cone for array access indices may betagged in some manner. As may be seen, the exemplary graphical firstprogram of FIG. 7A includes state variables 702, which, as shown, are ina fanin cone for the graphical program. As those of skill know, a fanincone refers to logic or program code that drives an input, pin, or port.

As also shown, the exemplary first program further includes a FOR loop710, configured to process input data using one or more variables ofinterest 704, indicated by the oval inside the FOR loop. The FOR loop(of loop max=16) iteratively reads a location (i+offset) from a memory,multiplies the read value by (i+offset), and then writes back to thesame location (i+offset). Note that the memory is initialized to containall 0's initially. The offset is calculated by the logic outside the FORloop. This logic contains two feedback registers which retain theirvalues between successive calls of the program. Therefore, successivecalls of this program will update different sets of 16 locations of thearray.

Now, consider analyzing the read and write addresses of the array, whereall of the possible values for (i+offset) this program will actuallyexecute needs to be determined, which leads to the question, how manytimes must this program be executed to discover/determine all possiblevalues for (i+offset)? This data element or variable “i+offset” islabeled in FIG. 7A as “variable of interest 704. In other words, theconvergence number for this program for the variable “i+offset” needs tobe determined. Now, analyzing the fanin cone of the variable “i+offset”,the state variables in the two feedback nodes, labeled “state variablesin fanin cone”, may be determined (found).

Thus, the exemplary graphical first program includes state variables andat least one variable of interest.

In 606, values of the state variables for each array may be recorded.For example, the tagged nodes of 604 may be used to compose or create agraphical second program (e.g., as per 504 of FIG. 5), which may then beexecuted (e.g., as per 506 of FIG. 5) to generate the values of thestate variables. Prior to the first execution of the graphical secondprogram, these state variables may have or be given initial values. FIG.7B illustrates an exemplary graphical second program generated based ondependencies and state variables of the graphical first program of FIG.7A, where the graphical second program corresponds to the statevariables and their assignments/dependencies of the first program. Thissecond program may be used to determine the convergence number of thefirst program. Note the inclusion of the state variables in the fanincone 702 of the graphical first program of FIG. 7A (and conversely, theomission of other elements not germane to the values of the statevariables, including the FOR loop 710 and variable of interest 704,which may substantially speed the execution of the second program, andthus provide a quick way to determine the convergence number orproperty.

In 607, a determination may be made as to whether a specified executioncount threshold has been reached. If the execution count threshold hasbeen reached, the program (or program design) does not converge, asindicated in 608, and in some embodiments, a null or negative result maybe returned, e.g., for display to the user. Conversely, if the specifiedexecution count threshold has not been reached, then in 610, the taggednodes (from 604) may be executed, and in 612, the execution count may beincremented.

In 613, a determination may be made as to whether state values for eachmemory matched a value set recorded in a previous iteration, i.e., fromsome point in the execution history. If a match is not determined in613, the method may return to method element 606, as shown, and mayproceed as described above, recording the current (most recent) valuesof the state variables, per 606, and so forth. On the other hand, if amatch is determined in 613, then in 614, a convergence property (e.g.,convergence number) may be determined (and stored). For example, in theembodiment shown, the convergence number/property may be the currentexecution count minus 1 (execution count−1), although other forms of theconvergence property are also contemplated, as noted above.

Describing the above in a different way, in one exemplary embodiment,given a set of variables in a first program, its convergence number maybe determined by extracting state variables based on the dependency ofthe program variables, and a second (e.g., smaller) program may begenerated based on the state variables and dependency. The secondprogram may be executed multiple times in an iterative manner, andvalues of the state variables recorded (each execution) until avariable/value configuration is found that has been previously recorded.The number of this execution (possibly minus 1, depending on thecounting approach) may be returned or stored as the convergence numberfor the graphical first program (and the graphical second program, aswell).

Note that the convergence property (or number) is thus generated withouthaving to execute the entire first program, which may providesignificant savings in time and/or execution resources.

Thus, various embodiments of the above techniques may provide for rapidconvergence analysis of programs.

Creating a Graphical Program

As noted above, in some embodiments, the programs implementing thetechniques disclosed herein and/or the programs to which the techniquesare applied, may be graphical programs. The following describes variousexemplary embodiments of graphical program creation.

A graphical program may be created on the computer system 82 (or on adifferent computer system). The graphical program may be created orassembled by the user arranging on a display a plurality of nodes oricons and then interconnecting the nodes to create the graphicalprogram. In response to the user assembling the graphical program, datastructures may be created and stored which represent the graphicalprogram. The nodes may be interconnected in one or more of a data flow,control flow, or execution flow format. The graphical program may thuscomprise a plurality of interconnected nodes or icons which visuallyindicates the functionality of the program. As noted above, thegraphical program may comprise a block diagram and may also include auser interface portion or front panel portion. Where the graphicalprogram includes a user interface portion, the user may optionallyassemble the user interface on the display. As one example, the user mayuse the LabVIEW graphical programming development environment to createthe graphical program.

In an alternate embodiment, the graphical program may be created by theuser creating or specifying a prototype, followed by automatic orprogrammatic creation of the graphical program from the prototype. Thisfunctionality is described in U.S. patent application Ser. No.09/587,682 titled “System and Method for Automatically Generating aGraphical Program to Perform an Image Processing Algorithm”, which ishereby incorporated by reference in its entirety as though fully andcompletely set forth herein. The graphical program may be created inother manners, either by the user or programmatically, as desired. Thegraphical program may implement a measurement function that is desiredto be performed by the instrument.

In another embodiment, a graphical user interface or front panel for thegraphical program may be created, e.g., in response to user input. Thegraphical user interface may be created in any of various ways, e.g.,depending on the graphical programming development environment used.

A block diagram for the graphical program may be created. The blockdiagram may be created in or using any graphical programming developmentenvironment, such as LabVIEW, Simulink, VEE, or another graphicalprogramming development environment. The block diagram may be created inresponse to direct user input, e.g., the user may create the blockdiagram by placing or “dragging and dropping” icons or nodes on thedisplay and interconnecting the nodes in a desired fashion.Alternatively, the block diagram may be programmatically created from aprogram specification. The plurality of nodes in the block diagram maybe interconnected to visually indicate functionality of the graphicalprogram. The block diagram may have one or more of data flow, controlflow, and/or execution flow representations.

It is noted that the graphical user interface and the block diagram maybe created separately or together, in various orders, or in aninterleaved manner. In one embodiment, the user interface elements inthe graphical user interface or front panel may be specified or created,and terminals corresponding to the user interface elements may appear inthe block diagram in response. For example, when the user places userinterface elements in the graphical user interface or front panel,corresponding terminals may appear in the block diagram as nodes thatmay be connected to other nodes in the block diagram, e.g., to provideinput to and/or display output from other nodes in the block diagram. Inanother embodiment, the user interface elements may be created inresponse to the block diagram. For example, the user may create theblock diagram, wherein the block diagram includes terminal icons ornodes that indicate respective user interface elements. The graphicaluser interface or front panel may then be automatically (or manually)created based on the terminal icons or nodes in the block diagram. Asanother example, the graphical user interface elements may be comprisedin the diagram.

Although the embodiments above have been described in considerabledetail, numerous variations and modifications will become apparent tothose skilled in the art once the above disclosure is fully appreciated.It is intended that the following claims be interpreted to embrace allsuch variations and modifications.

We claim:
 1. A non-transitory computer accessible memory medium thatstores program instructions executable by a processor to implement:determining, based on dependencies of one or more variables in a firstprogram, one or more state variables of the first program, wherein theone or more variables comprise one or more of: at least one variable inat least one array indexing expression for an array in the firstprogram; at least one set of variables that is dependent upon itself; orat least one variable whose value is set by an operation that includesinput or output range properties to be optimized; creating, based on theone or more state variables and dependencies of the one or more statevariables, a second program corresponding to the first program;executing the second program a plurality of times, comprising: for eachexecution: recording values of the one or more state variables;determining an execution count; comparing the values to correspondingvalues from previous executions of the second program; and terminatingsaid executing in response to determining that the values matchcorresponding values from at least one previous execution of the secondprogram; determining, based on the execution count, a convergenceproperty for the first program that indicates a number of executions ofthe first program required to generate all possible values of the one ormore variables; and storing the convergence property, wherein theconvergence property is useable to optimize the first program.
 2. Thenon-transitory computer accessible memory medium of claim 1, wherein theone or more variables have data types comprising one or more of: scalar;array; or heterogeneous data structure.
 3. The non-transitory computeraccessible memory medium of claim 1, wherein the first program comprisesone or more of: a data flow program; a graphical program; a graphicaldata flow program; or a hardware description program.
 4. Thenon-transitory computer accessible memory medium of claim 1, wherein thefirst program comprises one or more of: a procedural program; afunctional program; a textual program; or a declarative program.
 5. Thenon-transitory computer accessible memory medium of claim 1, whereinsaid determining one or more state variables, said creating, and saidexecuting are performed as part of compiling the first program.
 6. Thenon-transitory computer accessible memory medium of claim 1, whereinsaid executing the second program comprises one or more of: runningcompiled code on a computer, wherein the compiled code is generated fromat least a portion of the second program; interpreting programstatements of at least a portion of the second program; or evaluatingoperations in a graph generated from at least a portion of the secondprogram.
 7. The non-transitory computer accessible memory medium ofclaim 1, wherein the convergence property comprises one or more of: afinite integer value; a real value, indicating a fractional execution ofthe program; an indication that there is no convergence; or aconvergence property for each variable of at least a subset of variablesin the first program.
 8. The non-transitory computer accessible memorymedium of claim 1, wherein the dependencies comprise one or more of: adata dependency through variable assignment; a control dependencythrough control structures; or a transitive closure of a data or controldependency.
 9. The non-transitory computer accessible memory medium ofclaim 1, wherein the one or more state variables comprise one or moreof: at least one static variable; at least one global variable; at leastone feedback node in a dataflow language; at least one modal parameter;or at least one parameter that takes on one of a plurality of valuesthroughout execution of the first program.
 10. The non-transitorycomputer accessible memory medium of claim 1, wherein the second programis one or more of: smaller than the first program; a program thatexecutes faster than the first program; an empty program with no statevariables; or the same as the first program.
 11. The non-transitorycomputer accessible memory medium of claim 1, wherein the programinstructions are further executable to implement: compiling the firstprogram based on the convergence property, said compiling comprisinggenerating code configured to run on one or more of: a desktop computerwith one or more central processing unit (CPU) cores; an embeddedcomputer with one or more CPU cores; a graphics processing unit (GPU);an embedded GPU; a field programmable gate array (FPGA); or anapplication specific integrated circuit (ASIC).
 12. The non-transitorycomputer accessible memory medium of claim 11, wherein said recordingvalues of the one or more state variables comprises one or more of:collecting unique values assigned to each state variable; or collectingone or more derivative properties for values assigned to each statevariable.
 13. The non-transitory computer accessible memory medium ofclaim 12, wherein the program instructions are further executable toimplement: optimizing the first program based on the convergenceproperty.
 14. The non-transitory computer accessible memory medium ofclaim 13, wherein said optimizing the first program based on theconvergence property comprises one or more of: constant propagation andfolding; range propagation and minimization; array size inference; deadcode elimination; loop transformations, array transformations; memoryoptimization; inserting assertions; inserting code coverageinstrumentation; loop unrolling; in-lining of subprograms; out-lining ofportions of programs; data type propagation and refinement; float tofixed data type conversion; optimization of overflow/quantizationoperations; type conversion insertion; or converting to look-up tableimplementations.
 15. A computer-implemented method, the methodcomprising: utilizing a computer to perform: determining, based ondependencies of one or more variables in a first program, one or morestate variables of the first program; creating, based on the one or morestate variables and dependencies of the one or more state variables, asecond program corresponding to the first program; executing the secondprogram a plurality of times, comprising: for each execution: recordingvalues of the one or more state variables, wherein said recording valuesof the one or more state variables comprises one or more of:  collectingunique values assigned to each state variable; or  collecting one ormore derivative properties for values assigned to each state variable;determining an execution count; comparing the values to correspondingvalues from previous executions of the second program; and terminatingsaid executing in response to determining that the values matchcorresponding values from at least one previous execution of the secondprogram; determining, based on the execution count, a convergenceproperty for the first program that indicates a number of executions ofthe first program required to generate all possible values of the one ormore variables; and storing the convergence property, wherein theconvergence property is useable to optimize the first program.
 16. Thecomputer-implemented method of claim 15, wherein the first programcomprises one or more of: a data flow program; a graphical program; agraphical data flow program; a hardware description program; aprocedural program; a functional program; a textual program; or adeclarative program.
 17. The method of claim 15, wherein saiddetermining one or more state variables, said creating, and saidexecuting are performed as part of compiling the first program.
 18. Themethod of claim 15, wherein said executing the second program comprisesone or more of: running compiled code on a computer, wherein thecompiled code is generated from at least a portion of the secondprogram; interpreting program statements of at least a portion of thesecond program; or evaluating operations in a graph generated from atleast a portion of the second program.
 19. The method of claim 15,wherein the convergence property comprises one or more of: a finiteinteger value; a real value, indicating a fractional execution of theprogram; an indication that there is no convergence; or a convergenceproperty for each variable of at least a subset of variables in thefirst program.
 20. The method of claim 19, further comprising: compilingthe first program based on the convergence property, said compilingcomprising generating code configured to run on one or more of: adesktop computer with one or more central processing unit (CPU) cores;an embedded computer with one or more CPU cores; a graphics processingunit (GPU); an embedded GPU; a field programmable gate array (FPGA); oran application specific integrated circuit (ASIC).
 21. The method ofclaim 15, wherein the program instructions are further executable toimplement: optimizing the first program based on the convergenceproperty.
 22. The method of claim 21, wherein said optimizing the firstprogram based on the convergence property comprises one or more of:constant propagation and folding; range propagation and minimization;array size inference; dead code elimination; loop transformations, arraytransformations; memory optimization; inserting assertions; insertingcode coverage instrumentation; loop unrolling; in-lining of subprograms;out-lining of portions of programs; data type propagation andrefinement; float to fixed data type conversion; optimization ofoverflow/quantization operations; type conversion Insertion; orconverting to look-up table implementations.
 23. A non-transitorycomputer accessible memory medium that stores program instructionsexecutable by a processor to implement: determining, based ondependencies of one or more variables in a first program, one or morestate variables of the first program; creating, based on the one or morestate variables and dependencies of the one or more state variables, asecond program corresponding to the first program; executing the secondprogram a plurality of times, comprising: for each execution: recordingvalues of the one or more state variables, wherein said recording valuesof the one or more state variables comprises one or more of: collectingunique values assigned to each state variable; or collecting one or morederivative properties for values assigned to each state variable;determining an execution count; comparing the values to correspondingvalues from previous executions of the second program; and terminatingsaid executing in response to determining that the values matchcorresponding values from at least one previous execution of the secondprogram; determining, based on the execution count, a convergenceproperty for the first program that indicates a number of executions ofthe first program required to generate all possible values of the one ormore variables; and storing the convergence property, wherein theconvergence property is useable to optimize the first program.